﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using CourseUtils;


namespace CRUD
{
    public class Tools
    {
        #region prorerties
        String Path { get; set; }
        String FileName {get; set;}
        String FullFileName {get; set;}
        #endregion

        #region There are the checking and creation methods for directory, files of data base tables 
        public bool IsDirectoryExist(string Path)
        {
            DirectoryInfo dr = new DirectoryInfo(Path);
            return dr.Exists;
        }

        public void CreateDirectory(string Path)
        {
            DirectoryInfo dr = new DirectoryInfo(".");
            dr.CreateSubdirectory(Path);
        }
        public bool IsTableExist(string FullFileName)
        {
            bool IsExist = false;
            FileInfo dir = new FileInfo(FullFileName);
            IsExist = dir.Exists;
            return IsExist;
        }
        public void CreateDataBaseFile(String FullFileName)
        {
            FileInfo f = new FileInfo(FullFileName);
            FileStream fs = f.Create();
            fs.Close();
        }
        #endregion

        #region Methods for feading of the data base tables


        #endregion

        public Staff FeedStaffRecord(Staff newRecord)
        {
            newRecord.StaffNo = CourseUtils.IOHelpers.ReadStringFromConsole("Inset staffNo [2 letters and 1 or 2 simbols]\n");
            newRecord.FName = CourseUtils.IOHelpers.ReadStringFromConsole("Inset first name\n");
            newRecord.LName = CourseUtils.IOHelpers.ReadStringFromConsole("Inset last name\n");
            newRecord.Position = CourseUtils.IOHelpers.ReadStringFromConsole("Inset position in company\n");
            newRecord.Sex = CourseUtils.IOHelpers.ReadStringFromConsole("Inset sex [M or F]");
            int Day = CourseUtils.IOHelpers.ReadIntFromConsole("Inset Day of birth");
            int Month = CourseUtils.IOHelpers.ReadIntFromConsole("Inset month of birth");
            int Year = CourseUtils.IOHelpers.ReadIntFromConsole("Inset year of birth");
            DateTime DateOfBirth = new DateTime(Year, Month, Day);
            newRecord.Salary = CourseUtils.IOHelpers.ReadStringFromConsole("Inset salary in GB pounds\n");
            newRecord.BranchNo = CourseUtils.IOHelpers.ReadStringFromConsole("Inset branchNo, if you know [1 character and 3 symbols");
            return newRecord;
        }
    }
}
